package com.junzhiit.nengji.shop.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum BalanceHistoryOperation {
	STORAGE_VALUE(0,"储值"),
	CONSUMPTION(1,"支付");
	
	private Integer value;
	private String text;
	
	private BalanceHistoryOperation(Integer value,String text){
		this.value = value;
		this.text = text;
	}

	public Integer toIntValue() {
		return this.value;
	}
	
	public String toStringText() {
		return this.text;
	}

	public static BalanceHistoryOperation toValue(int value) {
		if (STORAGE_VALUE.value == value) {
			return STORAGE_VALUE;
		} else if (CONSUMPTION.value == value) {
			return CONSUMPTION;
		} else {
			throw new InvalidArgumentException("Unknown status[" + value + "].");
		}
	}
}
